Skip to content

test(studio): a slow frame no longer splits the edit bench's nudge burst into two saves - #8809

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/edit-bench-nudge-keys-one-burst
Nov 25, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/edit-bench-nudge-keys-one-burst

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The edit accuracy bench presses the keys of one nudge burst back to back, so a slow frame between two keys no longer splits the burst into two saves. seqrotatenudge-* cases stop failing undo and reload on a run where the frame after the first nudge is slow.

Why

The gate has reported seqrotatenudge-none-center-r0-root-z100 and seqrotatenudge-none-pct-r0-nested-z100 as Unstable on several PR heads (#8784, #8787, #8794, #8801). One run of three failed with reload 3.03 px and undo false. The other two passed. CI's gate runs the default (unsealed) preview.

The bench pressed a nudge key, waited for a frame, then pressed the next. Studio saves a burst once it has had no key for CANVAS_NUDGE_COMMIT_DEBOUNCE_MS (400 ms, packages/studio/src/components/editor/domEditNudge.ts). In the failing runs, the frame after the first nudge key took 422 ms (#8801) and 397 ms (#8784). So the second key came after the burst had already saved, and the 3 nudges saved twice. From the shard artifacts:

Run Saves seen / owed Longest frame in the nudge step undo bytes reload
#8801 center-root run 1 3 / 2 422 ms false 3.03 px
#8801 center-root runs 2, 3 2 / 2 139 ms, 197 ms true 0
#8784 pct-nested run 1 3 / 2 397 ms false 3.02 px
#8784 pct-nested runs 2, 3 2 / 2 314 ms, 180 ms true 0

With 3 saves, the sequence's two undos leave the rotate's save in place. That gives different bytes on undo, and the reloaded box keeps the rotation without the nudges, 3 px from where the steps left it.

The slow frame is GPU-side. A trace of the nudge step on the devbox shows a 91 ms task on the GPU main thread, plus ANGLE shader-compile work, inside a 111 ms frame. Studio's page ran 18 ms of script in that frame. It appears on the first nudge after a rotate, and not in nudge-* or seqnudge-* cases. A person's keys don't wait for frames, so two keys 400+ ms apart being two undo steps is Studio working as designed. The bench's pace was wrong.

Related work

Refs #8784, #8801 (PR heads whose gate reported the Unstable rows).

How

  • case.mjs: pressNudges(page, count) presses the burst's keys back to back, then waits one frame. That last frame is the one each caller had after the burst's final key.
  • pressNudges is now the only code that presses nudge keys. The sequence's nudge step, the single-nudge gesture and the blank-page control all call it, so they keep the same pace. grep -n ArrowRight over tests/e2e/edit-accuracy/*.mjs finds only the helper.
  • The text-typing step keeps one key per frame. Its comment no longer cites the nudges.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix: packages/studio/tests/e2e/edit-accuracy/saves.test.mjs "presses every key inside Studio's burst window, however slow a frame is" fails on the old pace (a frame wait between keys) with expected 900 to be less than 400. It uses a page whose frame takes 450 ms.

npx vitest run tests/e2e/edit-accuracy/ in packages/studio: 13 files, 131 of 131, three runs in a row.

The mechanism, on the devbox with main fbdfd188c4 built (the six seqrotatenudge-* cases, the page-side time of each nudge keydown logged):

Bench Preview Runs Saves per case Gap between nudge keys Result
main unsealed 3 x 6 cases 2 4 to 129 ms 18 of 18 pass
main sealed 3 x 6 cases 2 4 to 85 ms 17 of 18 pass (see below)
main, waits 450 ms after key 1 unsealed 2 cases 3 478, 484 ms undo false, reload 3.02 px in both
main, waits 450 ms after key 1 sealed 2 cases 3 470, 476 ms undo false, reload 3.02 px in both

The 450 ms wait stands in for the slow frame. It gives the CI failure exactly, in both modes.

Still open, not this change: in one of the 18 sealed runs, seqrotatenudge-none-pct-r0-nested-z100 had reload 3.02 px with 2 saves and undo true. That's a different failure, still being looked at.

Not run yet: the bench with this branch's pace. Runs of the nudge cases in both modes, and the full pr grid sealed three times, follow in a comment.

No visible change

…rst into two saves

The bench pressed each nudge key, then waited for a frame. On CI the frame after
the first nudge following a rotate can take 400+ ms (GPU-side), longer than
Studio's 400 ms burst window, so the burst saved twice and the undo walk came
up one short. The keys of a burst now go back to back through one helper.
@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 50 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at ac77ad94.

I read the diff and the three touched bench files. pressNudges is the only place the bench presses ArrowRight now; the other files in edit-accuracy/ have no arrow-key presses. The sequence nudge step, the single-nudge gesture and the blank-page control all go through it, so they keep one pace. The text-typing step keeps its frame-per-key pace.

The new test in saves.test.mjs uses a page whose frame is 450 ms, longer than CANVAS_NUDGE_COMMIT_DEBOUNCE_MS. It would fail on the old frame-per-key pace, since the keys would land about 900 ms apart. That matches the "fails without the fix:" line in the body.

This changes how the bench presses keys, not Studio. The product still saves a burst once it has had no key for 400 ms, so two keys more than 400 ms apart are still two undo steps. I think that is right for a person pressing keys, since they don't wait for frames. If you want to know whether a slow frame in Studio should be able to split a real user's key-repeat burst, that is a product question and a follow-up, not a blocker here.

The author notes that the sealed-mode pct-nested reload 3.02 px with 2 saves is a different failure and still open. That is not caused by this PR.

All checks are green on this head, including the edit accuracy shards.

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Bench runs with this branch's pace, as promised in the body. pr grid, --jobs 2, the preview frame's self.origin logged in every case (null sealed).

Studio built at main 614ece8b, this branch's bench, the 48 seqrotatenudge-*, seqnudge-*, seqab-* and nudge-* cases:

Preview Run 1 Run 2 Run 3
sealed 48/48 48/48 46/48
unsealed 48/48

Every one of these runs had 2 saves in each seqrotatenudge case, so no burst split.

Run 3's two failures are seqrotatenudge-none-center-r0-nested-z100 and seqrotatenudge-none-px-r0-nested-z100, both with drop and reload 3.02 px, 2 saves and undo true. That's the separate sealed failure the body lists as open: the nudge step records the box before the sealed preview has drawn the nudges, and the saved file and the reloaded box are right. On main's old pace it showed in 1 of 18 sealed seqrotatenudge runs, and here in 2 of 9 sealed seqrotatenudge nested runs. That's too few to tell whether the pace changes how often it happens. It gets its own PR.

An earlier build (main fbdfd188) lost the first drag of sealed seqab-none-*-r0-nested-z100 in 18 of 18 runs, with main's bench and with this branch's bench alike. That's the bug #8772 fixed: it's gone at 614ece8b, in 0 of 144 sealed case-runs.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 1706711 Nov 25, 2026
88 checks passed
@miguel-heygen
miguel-heygen deleted the fix/edit-bench-nudge-keys-one-burst branch November 25, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants